package timeseries
import (
"github.com/K-Phoen/grabana/target/graphite"
"github.com/K-Phoen/grabana/target/influxdb"
"github.com/K-Phoen/grabana/target/loki"
"github.com/K-Phoen/grabana/target/prometheus"
"github.com/K-Phoen/grabana/target/stackdriver"
"github.com/K-Phoen/sdk"
)
func WithPrometheusTarget (query string , options ...prometheus .Option ) Option {
target := prometheus .New (query , options ...)
return func (graph *TimeSeries ) error {
graph .Builder .AddTarget (&sdk .Target {
RefID : target .Ref ,
Hide : target .Hidden ,
Expr : target .Expr ,
IntervalFactor : target .IntervalFactor ,
Interval : target .Interval ,
Step : target .Step ,
LegendFormat : target .LegendFormat ,
Instant : target .Instant ,
Format : target .Format ,
})
return nil
}
}
func WithGraphiteTarget (query string , options ...graphite .Option ) Option {
target := graphite .New (query , options ...)
return func (graph *TimeSeries ) error {
graph .Builder .AddTarget (target .Builder )
return nil
}
}
func WithInfluxDBTarget (query string , options ...influxdb .Option ) Option {
target := influxdb .New (query , options ...)
return func (graph *TimeSeries ) error {
graph .Builder .AddTarget (target .Builder )
return nil
}
}
func WithStackdriverTarget (target *stackdriver .Stackdriver ) Option {
return func (graph *TimeSeries ) error {
graph .Builder .AddTarget (target .Builder )
return nil
}
}
func WithLokiTarget (query string , options ...loki .Option ) Option {
target := loki .New (query , options ...)
return func (graph *TimeSeries ) error {
graph .Builder .AddTarget (&sdk .Target {
Hide : target .Hidden ,
Expr : target .Expr ,
LegendFormat : target .LegendFormat ,
})
return nil
}
}
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .